//index.js
const app = getApp()

Page({
  data: {
    avatarUrl: './user-unlogin.png',
    todoList: []
  },

  onLoad: function() {
    this.queryTodoList();
  },
  queryTodoList: function() {
    const db = wx.cloud.database();
    const todos = db.collection('todo_list');
    // 全量获取数据内容
    todos
      .get({
        limit: 20,
        success: rst => {
          this.setData({
            todoList: rst.data || []
          })
        }
      })
  },
  onShareAppMessage: function(obj) {
    return {
      title: 'hello 小程序'
    }
  }
})
